﻿#ifndef NctiPluginsManager_H
#define NctiPluginsManager_H
#include "ncti_dcl_PluginManager.h"
#include "ncti_base.h"
#include <vector>
namespace NCTI
{
	class NctiFuntionInterfaceManager;
	class NctiTessBodyObject;
	/**
	* @brief manager all the plugins
	* @details need to initialization when start the application
	*/
	class DECL_NCTI_PLUGINMANAGER NctiPluginsManager
	{
	public:
		NctiPluginsManager();
		~NctiPluginsManager();
	public:
		/**
	   * @brief create a golbal plugin manager
	   */
		static NctiPluginsManager* instance();
		/**
	   * @brief initialization the license,help to load other plugin license
	   * @param[in] i_strType, the type of product
	   * @param[in] i_FileFullPath, the application path
	   * @param[out] o_strMes, return the product string
	   */
		static NctiErrorType InitLicense(const char* i_strType, const char* i_FileFullPath, std::string& o_strMes);

		/**
	   * @brief release the license, help to release other plugin license
	   * @param[in] i_strType, the type of product
	   * @param[in] i_FileFullPath, the application path
	   * @param[out] o_strMes, return the product string
	   */
		static Ncti_Boolean ReleaseLicense();
	public:
		/**
	   * @brief load plugin
	   * @param[in] i_filename, the plugin file path
	   * @return Ncti_Boolean
	   */
		Ncti_Boolean LoadPlugin(const char* i_filename);
		/**
	   * @brief unload plugin
	   * @param[in] i_filename, the plugin file path
	   * @return Ncti_Boolean
	   */
		Ncti_Boolean UnLoadPlugin(const std::string& i_filename);
		/**
	   * @brief set temp full path, it is a application path
	   * @param[in] i_chTempFullPath, it is a application path
	   */
		void SetTempFullPath(const char* i_chTempFullPath);
	    /**
	   * @brief get temp full path, it is a application path
	   * @return const char*, it is a application path
	   */
		const char* GetTempFullPath(){ return  m_cpTempFullPath;}
		/**
	   * @brief set configuration full path, it is a config path
	   * @param[in] i_chConfigurationFile, it is a config path
	   */
		void SetConfigurationFile(const char* i_chConfigurationFile);
		/**
	   * @brief get configuration full path, it is a config path
	   * @return const char*, it is a config path
	   */
		const char* GetConfigurationFile(){ return  m_cpConfigurationFile;}
		/**
	   * @brief set render type, internal use
	   * @param[in] i_type
	   */
		void SetRenderModelType(Ncti_Integer i_type) { m_RenderModelType = i_type; }
		/**
	   * @brief get render type, internal use
	   * @return i_type
	   */
		Ncti_Integer GetRenderModelType() { return m_RenderModelType; }
		/**
	   * @brief get function interface manager
	   * @return NctiFuntionInterfaceManager*
	   */
		NctiFuntionInterfaceManager* GetFuntionInterfaceManager() { return m_FuntionInterfaceManager; }
		/**
	   * @brief get current working path
	   * @param[in] o_chPath, need to release the char point
	   */
		void getCurrentWorkingPath(char* o_chPath);
		/**
	   * @brief get all load file list
	   * @return const std::vector<std::string>&
	   */
		const std::vector<std::string>& GetLoadFileVec() { return m_LoadFileVec; }
		/**
	   * @brief set object face visible state
	   * @param[in] i_boo
	   */
		void SetObjectFaceVisible(Ncti_Boolean i_boo);
		/**
	   * @brief set object line visible state
	   * @param[in] i_boo
	   */
		void SetObjectLineVisible(Ncti_Boolean i_boo);
		/**
	   * @brief set object vertex visible state
	   * @param[in] i_boo
	   */
		void SetObjectVertexVisible(Ncti_Boolean i_boo);
		/**
	   * @brief get object face visible state
	   * @return Ncti_Boolean
	   */
		Ncti_Boolean GetObjectFaceVisible();
		/**
	   * @brief get object line visible state
	   * @return Ncti_Boolean
	   */
		Ncti_Boolean GetObjectLineVisible();
		/**
	   * @brief get object vertex visible state
	   * @return Ncti_Boolean
	   */
		Ncti_Boolean GetObjectVertexVisible();
	public:
		/**
	   * @brief get record information state
	   * @return Ncti_Boolean
	   */
		Ncti_Boolean IsOpenRecordInfor() { return m_IsOpenRecordInfor; }
		/**
	   * @brief set record information state
	   * @param[in] i_boo
	   */
		void SetOpenRecordInfor(Ncti_Boolean i_boo) { m_IsOpenRecordInfor = i_boo; }
		/**
	   * @brief get GEGeom information state
	   * @return Ncti_Boolean
	   */
		Ncti_Boolean IsCreateGEGeom() { return m_IsCreateGEGeom; }
		/**
	   * @brief set GEGeom information state,Geometric Object to Platform Object Conversion
	   * @param[in] i_boo
	   */
		void SetCreateGEGeom(Ncti_Boolean i_boo) { m_IsCreateGEGeom = i_boo; }
		/**
	   * @brief get import assembly file state,Geometric Object to Platform Object Conversion
	   * @return Ncti_Boolean
	   */
		Ncti_Boolean IsImportAssemelFile() { return m_IsImportAssemelFile; }
		/**
	   * @brief set import assembly file state, Import files in assembly drawing format
	   * @param[in] i_boo
	   */
		void SetImportAssemelFile(Ncti_Boolean i_boo) { m_IsImportAssemelFile = i_boo; }
		/**
	   * @brief get shapes orientation state, Import files in assembly drawing format
	   * true：Use Oriented- ShapeHash and ShapeEqual if you want to consider orientation of shape in hash computing
	   * false：Use Unoriented- ShapeHash and ShapeEqual if shape orientation is negligible
	   * @return Ncti_Boolean
	   */
		Ncti_Boolean GetShapesOrientation() { return m_ShapesOrientationIsUsed; }
		/**
	   * @brief set shapes orientation state
	   * true：Use Oriented- ShapeHash and ShapeEqual if you want to consider orientation of shape in hash computing
	   * false：Use Unoriented- ShapeHash and ShapeEqual if shape orientation is negligible
	   * @param[in] i_boo
	   */
		void SetShapesOrientation(Ncti_Boolean i_boo) { m_ShapesOrientationIsUsed = i_boo; }
		/**
	   * @brief get read only mesh state, AI read only mesh when not displayed!(read ncti file)
	   * @return Ncti_Boolean
	   */
		Ncti_Boolean GetReadOnlyMesh() { return m_ReadOnlyMesh; }
		/**
	   * @brief set read only mesh state, AI read only mesh when not displayed!(read ncti file)
	   * @param[in] i_boo
	   */
		void SetReadOnlyMesh(Ncti_Boolean i_boo) { m_ReadOnlyMesh = i_boo; }

		/**
	   * @brief get record result state
	   * @return Ncti_Boolean
	   */
		Ncti_Boolean GetEnableRecordResult() { return m_IsEnableRecordResult; }

		/**
	   * @brief set record result state
	   * @param[in] i_boo
	   */
		void SetEnableRecordResult(Ncti_Boolean i_boo) { m_IsEnableRecordResult = i_boo; }

	public:
		/**
	   * @brief internal used
	   * @return NctiTessBodyObject
	   */
		NctiTessBodyObject* GetScaleL() { return m_TessBodyObjectScaleL; }
		/**
	   * @brief internal used
	   * @return NctiTessBodyObject
	   */
		NctiTessBodyObject* GetScaleN() { return m_TessBodyObjectScaleN; }
	protected:
		/**
	   * @brief internal used
	   * @return Ncti_Boolean
	   */
		Ncti_Boolean initlicense(const char* i_FileFullPath = nullptr);
		/**
	   * @brief internal used
	   * @return Ncti_Boolean
	   */
		Ncti_Boolean releaselicense();
	private:
		static NctiPluginsManager* m_instance;
	private:
		char* m_cpFileFullPathHoops;
		char* m_cpTempFullPath;
		char* m_cpConfigurationFile;
		Ncti_Integer m_RenderModelType;
		NctiFuntionInterfaceManager* m_FuntionInterfaceManager;
		NctiTessBodyObject* m_TessBodyObjectScaleL;
		NctiTessBodyObject* m_TessBodyObjectScaleN;
		std::vector<std::string> m_LoadFileVec;
		std::vector<void*> m_DLLVec;
	private:
		Ncti_Boolean m_Face_Visible;
		Ncti_Boolean m_Line_Visible;
		Ncti_Boolean m_Vertex_Visible;
	private:
		Ncti_Boolean m_IsOpenRecordInfor;
		Ncti_Boolean m_IsCreateGEGeom;
		Ncti_Boolean m_IsImportAssemelFile;
		Ncti_Boolean m_ShapesOrientationIsUsed;
		Ncti_Boolean m_ReadOnlyMesh;
		Ncti_Boolean m_IsEnableRecordResult;
	
	};
}
#endif
